package si.yun.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import si.yun.dao.SyUserMapper;
import si.yun.entity.SyUser;
import si.yun.service.SyAccountSelService;
import si.yun.utils.TestAliUpload;

/**
 * @ClassName: 查询账户持久层
 * @Description: TODO
 * @Author: 柴秋生
 * @Date 2021/8/17 16:06
 */
@Service
public class SyAccountSelServiceImpl implements SyAccountSelService {
    @Autowired
    private SyUserMapper syUserMapper;

    @Autowired
    public TestAliUpload testAliUpload;

    /**
     * 修改账户头像
     * @Author : 柴秋生
     * @Date : 2021/9/27 17:01
     * @Param : [syUser]
     * @Return : int
     */
    @Override
    public int updAvatarUrl(Integer id,String avatarUrl) {

        //删除服务器之前用户图片
        testAliUpload.delete(syUserMapper.getUserUrl(id));

        //修改用户图片
        int updAvatarUrl=syUserMapper.updAvatarUrl(id,avatarUrl);
        return updAvatarUrl;
    }
    /**
     * @Author : 李振海
     * @Date : 2021/9/14 10:37
     * @Param : [id, s]
     * @Return : int
     * 修改密码
     */
    @Override
    public int updUserPwd(Integer id, String s) {
        int updUserPwd= syUserMapper.updUserPwd(id,s);
        return updUserPwd;
    }
	/**
     * @Description 获取密码
     * @return java.lang.String
     * @Date 2021/12/24 10:47
     */
    @Override
    public String getPassword(Integer id,String account) {
        String password = syUserMapper.getPassword(id,account);
        return password;
    }
    /**
     * @Description 获取账号
     * @return java.lang.String
     * @Date 2021/12/27 20:54
     */
    @Override
    public String getAccount(String account) {
        String account1 = syUserMapper.getAccount(account);
        return account1;
    }
    /**
     * @Description 获取用户手机号
     * @return java.lang.String
     * @Date 2021/12/28 14:41
     */
    @Override
    public String getPhoneNumber(String account) {
        String phoneNumber = syUserMapper.getPhoneNumber(account);
        return phoneNumber;
    }
    /**
     * @Description 修改密码
     * @return int
     * @Date 2021/12/29 10:19
     */
    @Override
    public int setPwd(String newpwd, String account) {
        int npwd = syUserMapper.setPwd(newpwd, account);
        return npwd;
    }
}
